    function color() {
    //1.得到所有<tr>元素
    var trs = document.getElementsByTagName("tr");
    var i;
    for(i = 1; i <trs.length; i++) 
    {
        //2.改变<tr>元素的背景颜色
        if(i % 2 == 0) {
        trs[i].style.background = "#ccc";
        } else {
        trs[i].style.background = "#F3F3F3";
        }
    }
 }
window.onload = color;